home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1997 / HAM Radio 1997.iso / vcls / novtli / nwsap.pas < prev    next >
Pascal/Delphi Source File  |  1996-04-08  |  3KB  |  104 lines

  1. unit Nwsap;
  2. interface
  3. uses
  4.   nxtw;
  5. const
  6.   SAP_SOCKET          =   $452;
  7.   SAP_PACKET_TYPE     =   2;
  8.   ONE_MINUTE          =   (60 * 18);
  9.   IPX_EVENT_CANCELED  =   $FC;
  10.   NOT_SUPPORTED       =   1;
  11.   INVALID_QUERY_TYPE  =   2;
  12.   PERIODIC_ID_PACKET  =   2;
  13.   SUCCESSFUL          =   $00;
  14.   FAILURE             =   (-1);
  15.   RESPONSE_ID_PACKET  =     4;
  16.   MAX_NUM_APPS        =    10;
  17.  
  18.  
  19.   OPEN_SAP_SOCKET_ERROR        =  $60;
  20.   TOO_MANY_SERVERS_ON_NODE     =  $61;
  21.   SAP_MEMORY_ALLOC_ERROR       =  $62;
  22.   SERVER_ALREADY_ADVERTISING   =  $63;
  23.   MULTIPLE_INSTANCES_ON_SOCKET =  $64;
  24.   SAP_MEMORY_FREE_ERROR        =  $65;
  25.   SAP_MEMORY_UNLOCK_ERROR      =  $66;
  26.   SAP_ECB_NOT_CANCELLED        =  $67;
  27.   SAP_SERVER_NOT_ADVERTISING   =  $68;
  28.  
  29. type
  30.    SAPHeader = record
  31.       checksum: word;            (* high-low 1's complement *)
  32.       length: word;              (* high-low unsigned int *)
  33.       transportControl: byte;
  34.       packetType: byte;
  35.       destination: IPXAddress;
  36.       source: IPXAddress;
  37.       SAPPacketType: word;       (* 2 or 4 *)
  38.       serverType: word;          (* assigned by Novell *)
  39.       serverName: array[0..47] of byte;      (* VAP name *)
  40.       serverAddress: IPXAddress; (* server internet address *)
  41.       interveningNetworks: WORD; (* # of networks packet must traverse *)
  42.    end;
  43.  
  44.  
  45.    SAPQueryPacket = record
  46.       checksum: WORD;            (* high-low 1's complement *)
  47.       length: WORD;              (* high-low unsigned int *)
  48.       transportControl: BYTE;
  49.       packetType: BYTE;
  50.       destination: IPXAddress;
  51.       source: IPXAddress;
  52.       queryType: WORD;           (* high-low, 1 or 3 *)
  53.       serverType: WORD;          (* high-low, assigned by Novell *)
  54.     end;
  55.  
  56.  
  57.    (* SAP packet *)
  58.    SAP_BUFFER = record
  59.       theECB: ECB;
  60.       packet: SAPHeader;
  61.    end;
  62.  
  63.  
  64.    SAP = record
  65.       Header: IPXHeader;
  66.       ResponseType: WORD;        (* HI - LO   *)
  67.       ServerType: WORD;          (* HI - LO   *)
  68.       ServerName: array[0..47] of char;
  69.       Network: array[0..3] of char;          (* hi - lo   *)
  70.       Node: array[0..5] of char;             (* hi - lo   *)
  71.       Socket: array[0..1] of char;           (* hi - lo   *)
  72.       InterveningNetworks: WORD  (* hi - lo   *)
  73.    end;
  74.  
  75.  
  76.    SEND_PACKET = record
  77.       theECB: ECB;
  78.       SAPq: SAPQueryPacket;
  79.    end;
  80.  
  81.  
  82.    RECEIVE_PACKET = record
  83.       theECB: ECB;
  84.       SB: SAP;
  85.    end;
  86.  
  87.  
  88. procedure Advertiser(var usedECB: ECB);
  89. function AdvertiseService(x:WORD; y: PChar; var z: integer): integer;
  90. function InitializeSAP: integer;
  91. function QueryServices(queryType: word; serverType: word; returnSize: word; var serviceBuffer: SAP ): integer;
  92. procedure RespondToLocalQuery(var usedRespondECB: ECB);
  93. function ShutdownSAP(servername: PChar): integer;
  94.  
  95. implementation
  96. procedure Advertiser; external 'nwipxspx';
  97. function AdvertiseService; external 'nwipxspx';
  98. function InitializeSAP; external 'nwipxspx';
  99. function QueryServices; external 'nwipxspx';
  100. procedure RespondToLocalQuery; external 'nwipxspx';
  101. function ShutdownSAP; external 'nwipxspx';
  102.  
  103. end.
  104.